// page/mine/pages/fenxiaOrder/fenxiaoOrder.js
var app = getApp();
var that;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navbar: ['全部', '待付款', '已付款', '已完成'],
    currentTab: 0,
    userimg: wx.getStorageSync("bizUserInfo").wxHeadimg,
    wxNickNameStr: wx.getStorageSync("bizUserInfo").wxNickNameStr,
    MoneyList: [], //已付款
    allList: [], //全部
    completeList: [], //已完成
    waitMoneyList: [], //待付款
    loadingHidden: false,
    kong: true,
    selectArea: true,
    imgshow: false,
    shopinfobox: true,
  },
  navbarTap: function(e) {
    that = this
    that.currentTab = e.currentTarget.dataset.idx
    console.log(that.currentTab)
    that.setData({
      currentTab: that.currentTab
    })
  },
  /** 
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    that = this
    wx.request({
      //distributorId  分销商id  ${wx.getStorageSync("bizUserInfo").id}
      url: app.api.distributionOrder() + `?memberId=${wx.getStorageSync("bizUserInfo").id}`,
      // url: app.api.distributionOrder() + `?memberId=26`,
      method: 'GET',
      data: {},
      success: function(res) {
        if (res.statusCode == 200 && res.errMsg == 'request:ok') {
            if (res.data.data !== null) {
              console.log(res.data.data)

              that.setData({
                MoneyList: res.data.data.MoneyList,
                allList: res.data.data.allList,
                completeList: res.data.data.completeList,
                waitMoneyList: res.data.data.waitMoneyList,
                loadingHidden: true,
                kong: false,
              })
            } else {
              that.setData({
                loadingHidden: true,
                kong: false
              })
            }
          }
        }
    })
  },
  jtclickup: function() {
    this.setData({
      imgshow: !this.data.imgshow,
      shopinfobox: !this.data.shopinfobox,
    })
  },
  jtclickdown: function() {
    this.setData({
      selectArea: false,
      imgshow: !this.data.imgshow,
      shopinfobox: !this.data.shopinfobox,
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})